// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "Components/Widget.h"
#include "UI/Weapons/SCircumferenceMarkerWidget.h"

#include "CircumferenceMarkerWidget.generated.h"

class SWidget;
class UObject;
struct FFrame;

UCLASS()
class UCircumferenceMarkerWidget : public UWidget
{
	GENERATED_BODY()

public:
	UCircumferenceMarkerWidget(const FObjectInitializer& ObjectInitializer);

	//~UWidget 接口
public:
	/**
	 * 同步属性到 Slate 控件
	 */
	virtual void SynchronizeProperties() override;
protected:
	/**
	 * 重新构建 Slate 控件
	 */
	virtual TSharedRef<SWidget> RebuildWidget() override;
	//~UWidget 接口结束

	//~UVisual 接口
public:
	/**
	 * 释放 Slate 资源
	 * @param bReleaseChildren 是否同时释放子资源
	 */
	virtual void ReleaseSlateResources(bool bReleaseChildren) override;
	//~UVisual 接口结束
	
public:
	/** 绘制标记的位置/方向列表 */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance)
	TArray<FCircumferenceMarkerEntry> MarkerList; //标记列表

	/** 圆的半径 */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance, meta=(ClampMin=0.0))
	float Radius = 48.0f; //半径

	/** 放置在圆周围的标记图像 */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance)
	FSlateBrush MarkerImage; //标记图像

	/** 十字准星角图像是否放置在扩散半径之外 */
	//@TODO: 将其改为0-1浮点数对齐方式（例如，在半径内部/之上/外部）？
	UPROPERTY(EditAnywhere, Category=Corner)
	uint8 bReticleCornerOutsideSpreadRadius : 1; //十字准星角是否在扩散半径外

public:
	/** 设置圆的半径 */
	UFUNCTION(BlueprintCallable, Category = "Appearance")
	void SetRadius(float InRadius); //设置半径

private:
	/** 内部 Slate 控件，表示实际的标记视觉效果 */
	TSharedPtr<SCircumferenceMarkerWidget> MyMarkerWidget; //我的标记控件
};